// https://iai.sh.cn/problem/51
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  double sum = 0;
  int n = 0;
  for (int i = 0; i < s.size(); ++i) {
    switch (s[i]) {
    case 'A':
      sum += 4;
      n++;
      break;
    case 'B':
      sum += 3;
      n++;
      break;
    case 'C':
      sum += 2;
      n++;
      break;
    case 'D':
      sum += 1;
      n++;
      break;
    case '+':
      sum += 0.3;
      break;
    case '-':
      sum -= 0.3;
      break;
    }
  }
  cout << fixed << setprecision(2) << sum / n << endl;
  return 0;
}
